#ifndef MESSAGEITEM_H
#define MESSAGEITEM_H

#include <QLabel>
#include <QWidget>
#include"modle/data.h"
using module::Message;
class MessageItem : public QWidget
{
    Q_OBJECT
public:
    //构建MessageItem控件
    static MessageItem*makeMessageItem(bool isleft,const Message&mess);
    static QWidget*makeTextMessageItem(bool isleft,const QString&text);
    static QWidget*makeSpechMessageItem();
    static QWidget*makeImageMessageItem();
    static QWidget&makeFileMessageItem();

private:
    bool isleft;
    explicit MessageItem(bool isleft,QWidget *parent = nullptr);
};

//这个类的父控件就是MessageItem
//MessageItem构建的时候进行改控件的构建
class TextLable:public QWidget
{
    Q_OBJECT
public:
    TextLable(bool isleft,QString text,QWidget*parent=nullptr);
    void paintEvent(QPaintEvent*event)override;
private:
    bool isleft;
    QLabel *label;
};

#endif // MESSAGEITEM_H
